package org.nf.box.service.impl;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nf.box.domain.Like;
import org.nf.box.mapper.LikeMapper;
import org.nf.box.service.LikeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author lzp
 * @Date 2024-12-19
 * 点赞业务
 */
@Service("likeService")
@RequiredArgsConstructor
@Transactional(rollbackFor = RuntimeException.class)
@Slf4j
public class LikeServiceImpl implements LikeService {

    private final LikeMapper likeMapper;

    @Override
    public void addLick(Like like) {
        likeMapper.addLike(like);
    }

    @Override
    public Integer isLike(Integer userId, Integer postId) {
        return likeMapper.isLike(userId, postId);
    }
}
